package com.zhang.learns.mybatisplus.practice;

import org.springframework.context.ApplicationListener;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class LoginListen implements ApplicationListener<BaseEvent>{

    @Override
    public void onApplicationEvent(BaseEvent event) {


    }

    public static void main(String[] args) {
        LoginListen listen=new LoginListen();
        Class<?> cls =listen.getClass();
        //cls==>class com.mobile.thinks.login.listen.LoginListen
        System.out.println("cls==>"+cls);
        Type[] type=cls.getGenericInterfaces();
        Type types=cls.getGenericSuperclass();
        for(int i=0;i<type.length;i++){
            Type ty=type[i];
            if(ty instanceof ParameterizedType){
                Type[] sTypes=((ParameterizedType)ty).getActualTypeArguments();
                for(int j=0;j<sTypes.length;j++){
                    Type clsa=sTypes[j];
                    //范型类型==>class com.mobile.thinks.login.event.BaseEvent
                    System.out.println("范型类型==>"+(Class)clsa);
                }
            }
        }
    }


}